/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.mto.module.karaoke.service.persistence;

import com.liferay.portal.NoSuchModelException;
import com.liferay.portal.kernel.bean.BeanReference;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.ModelListener;
import com.liferay.portal.service.persistence.BatchSessionUtil;
import com.liferay.portal.service.persistence.ResourcePersistence;
import com.liferay.portal.service.persistence.UserPersistence;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

import com.mto.module.karaoke.NoSuchSongException;
import com.mto.module.karaoke.model.Song;
import com.mto.module.karaoke.model.impl.SongImpl;
import com.mto.module.karaoke.model.impl.SongModelImpl;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The persistence implementation for the song service.
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author vuonglm
 * @see SongPersistence
 * @see SongUtil
 * @generated
 */
public class SongPersistenceImpl extends BasePersistenceImpl<Song>
	implements SongPersistence {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. Always use {@link SongUtil} to access the song persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
	 */
	public static final String FINDER_CLASS_NAME_ENTITY = SongImpl.class.getName();
	public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
		".List1";
	public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
		".List2";
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGNAME = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySongName",
			new String[] {
				String.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGNAME =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySongName",
			new String[] { String.class.getName() },
			SongModelImpl.SONGNAME_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_SONGNAME = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySongName",
			new String[] { String.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGAUTHOR =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySongAuthor",
			new String[] {
				String.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGAUTHOR =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySongAuthor",
			new String[] { String.class.getName() },
			SongModelImpl.SONGAUTHOR_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_SONGAUTHOR = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySongAuthor",
			new String[] { String.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGCATEGORY =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySongCategory",
			new String[] {
				Integer.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGCATEGORY =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySongCategory",
			new String[] { Integer.class.getName() },
			SongModelImpl.SONGCATEGORY_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_SONGCATEGORY = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySongCategory",
			new String[] { Integer.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGSINGER =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySongSinger",
			new String[] {
				String.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGSINGER =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySongSinger",
			new String[] { String.class.getName() },
			SongModelImpl.SONGSINGER_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_SONGSINGER = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySongSinger",
			new String[] { String.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_RECORDNUMBER =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByRecordNumber",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RECORDNUMBER =
		new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByRecordNumber",
			new String[] { Long.class.getName() },
			SongModelImpl.RECORDNUMBER_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_RECORDNUMBER = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRecordNumber",
			new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, SongImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
	public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);

	/**
	 * Caches the song in the entity cache if it is enabled.
	 *
	 * @param song the song
	 */
	public void cacheResult(Song song) {
		EntityCacheUtil.putResult(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongImpl.class, song.getPrimaryKey(), song);

		song.resetOriginalValues();
	}

	/**
	 * Caches the songs in the entity cache if it is enabled.
	 *
	 * @param songs the songs
	 */
	public void cacheResult(List<Song> songs) {
		for (Song song : songs) {
			if (EntityCacheUtil.getResult(SongModelImpl.ENTITY_CACHE_ENABLED,
						SongImpl.class, song.getPrimaryKey()) == null) {
				cacheResult(song);
			}
			else {
				song.resetOriginalValues();
			}
		}
	}

	/**
	 * Clears the cache for all songs.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	@Override
	public void clearCache() {
		if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
			CacheRegistryUtil.clear(SongImpl.class.getName());
		}

		EntityCacheUtil.clearCache(SongImpl.class.getName());

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	/**
	 * Clears the cache for the song.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	@Override
	public void clearCache(Song song) {
		EntityCacheUtil.removeResult(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongImpl.class, song.getPrimaryKey());

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	@Override
	public void clearCache(List<Song> songs) {
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		for (Song song : songs) {
			EntityCacheUtil.removeResult(SongModelImpl.ENTITY_CACHE_ENABLED,
				SongImpl.class, song.getPrimaryKey());
		}
	}

	/**
	 * Creates a new song with the primary key. Does not add the song to the database.
	 *
	 * @param songId the primary key for the new song
	 * @return the new song
	 */
	public Song create(long songId) {
		Song song = new SongImpl();

		song.setNew(true);
		song.setPrimaryKey(songId);

		return song;
	}

	/**
	 * Removes the song with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param songId the primary key of the song
	 * @return the song that was removed
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song remove(long songId) throws NoSuchSongException, SystemException {
		return remove(Long.valueOf(songId));
	}

	/**
	 * Removes the song with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param primaryKey the primary key of the song
	 * @return the song that was removed
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Song remove(Serializable primaryKey)
		throws NoSuchSongException, SystemException {
		Session session = null;

		try {
			session = openSession();

			Song song = (Song)session.get(SongImpl.class, primaryKey);

			if (song == null) {
				if (_log.isWarnEnabled()) {
					_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
				}

				throw new NoSuchSongException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
					primaryKey);
			}

			return remove(song);
		}
		catch (NoSuchSongException nsee) {
			throw nsee;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	@Override
	protected Song removeImpl(Song song) throws SystemException {
		song = toUnwrappedModel(song);

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.delete(session, song);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		clearCache(song);

		return song;
	}

	@Override
	public Song updateImpl(com.mto.module.karaoke.model.Song song, boolean merge)
		throws SystemException {
		song = toUnwrappedModel(song);

		boolean isNew = song.isNew();

		SongModelImpl songModelImpl = (SongModelImpl)song;

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.update(session, song, merge);

			song.setNew(false);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

		if (isNew || !SongModelImpl.COLUMN_BITMASK_ENABLED) {
			FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
		}

		else {
			if ((songModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGNAME.getColumnBitmask()) != 0) {
				Object[] args = new Object[] { songModelImpl.getOriginalSongName() };

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGNAME, args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGNAME,
					args);

				args = new Object[] { songModelImpl.getSongName() };

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGNAME, args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGNAME,
					args);
			}

			if ((songModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGAUTHOR.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						songModelImpl.getOriginalSongAuthor()
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGAUTHOR,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGAUTHOR,
					args);

				args = new Object[] { songModelImpl.getSongAuthor() };

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGAUTHOR,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGAUTHOR,
					args);
			}

			if ((songModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGCATEGORY.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Integer.valueOf(songModelImpl.getOriginalSongCategory())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGCATEGORY,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGCATEGORY,
					args);

				args = new Object[] {
						Integer.valueOf(songModelImpl.getSongCategory())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGCATEGORY,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGCATEGORY,
					args);
			}

			if ((songModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGSINGER.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						songModelImpl.getOriginalSongSinger()
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGSINGER,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGSINGER,
					args);

				args = new Object[] { songModelImpl.getSongSinger() };

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SONGSINGER,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGSINGER,
					args);
			}

			if ((songModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RECORDNUMBER.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Long.valueOf(songModelImpl.getOriginalRecordNumber())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RECORDNUMBER,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RECORDNUMBER,
					args);

				args = new Object[] {
						Long.valueOf(songModelImpl.getRecordNumber())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RECORDNUMBER,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RECORDNUMBER,
					args);
			}
		}

		EntityCacheUtil.putResult(SongModelImpl.ENTITY_CACHE_ENABLED,
			SongImpl.class, song.getPrimaryKey(), song);

		return song;
	}

	protected Song toUnwrappedModel(Song song) {
		if (song instanceof SongImpl) {
			return song;
		}

		SongImpl songImpl = new SongImpl();

		songImpl.setNew(song.isNew());
		songImpl.setPrimaryKey(song.getPrimaryKey());

		songImpl.setSongId(song.getSongId());
		songImpl.setSongName(song.getSongName());
		songImpl.setSongAuthor(song.getSongAuthor());
		songImpl.setSongCategory(song.getSongCategory());
		songImpl.setSongSinger(song.getSongSinger());
		songImpl.setRecordNumber(song.getRecordNumber());
		songImpl.setSongUrl(song.getSongUrl());
		songImpl.setCreateDate(song.getCreateDate());
		songImpl.setModifiedDate(song.getModifiedDate());
		songImpl.setAudioUrl(song.getAudioUrl());

		return songImpl;
	}

	/**
	 * Returns the song with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
	 *
	 * @param primaryKey the primary key of the song
	 * @return the song
	 * @throws com.liferay.portal.NoSuchModelException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Song findByPrimaryKey(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return findByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Returns the song with the primary key or throws a {@link com.mto.module.karaoke.NoSuchSongException} if it could not be found.
	 *
	 * @param songId the primary key of the song
	 * @return the song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findByPrimaryKey(long songId)
		throws NoSuchSongException, SystemException {
		Song song = fetchByPrimaryKey(songId);

		if (song == null) {
			if (_log.isWarnEnabled()) {
				_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + songId);
			}

			throw new NoSuchSongException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
				songId);
		}

		return song;
	}

	/**
	 * Returns the song with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param primaryKey the primary key of the song
	 * @return the song, or <code>null</code> if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Song fetchByPrimaryKey(Serializable primaryKey)
		throws SystemException {
		return fetchByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Returns the song with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param songId the primary key of the song
	 * @return the song, or <code>null</code> if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchByPrimaryKey(long songId) throws SystemException {
		Song song = (Song)EntityCacheUtil.getResult(SongModelImpl.ENTITY_CACHE_ENABLED,
				SongImpl.class, songId);

		if (song == _nullSong) {
			return null;
		}

		if (song == null) {
			Session session = null;

			boolean hasException = false;

			try {
				session = openSession();

				song = (Song)session.get(SongImpl.class, Long.valueOf(songId));
			}
			catch (Exception e) {
				hasException = true;

				throw processException(e);
			}
			finally {
				if (song != null) {
					cacheResult(song);
				}
				else if (!hasException) {
					EntityCacheUtil.putResult(SongModelImpl.ENTITY_CACHE_ENABLED,
						SongImpl.class, songId, _nullSong);
				}

				closeSession(session);
			}
		}

		return song;
	}

	/**
	 * Returns all the songs where songName = &#63;.
	 *
	 * @param songName the song name
	 * @return the matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongName(String songName) throws SystemException {
		return findBySongName(songName, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}

	/**
	 * Returns a range of all the songs where songName = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songName the song name
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @return the range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongName(String songName, int start, int end)
		throws SystemException {
		return findBySongName(songName, start, end, null);
	}

	/**
	 * Returns an ordered range of all the songs where songName = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songName the song name
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongName(String songName, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGNAME;
			finderArgs = new Object[] { songName };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGNAME;
			finderArgs = new Object[] { songName, start, end, orderByComparator };
		}

		List<Song> list = (List<Song>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Song song : list) {
				if (!Validator.equals(songName, song.getSongName())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_SONG_WHERE);

			if (songName == null) {
				query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_1);
			}
			else {
				if (songName.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_3);
				}
				else {
					query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_2);
				}
			}

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (songName != null) {
					qPos.add(songName);
				}

				list = (List<Song>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first song in the ordered set where songName = &#63;.
	 *
	 * @param songName the song name
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongName_First(String songName,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongName_First(songName, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songName=");
		msg.append(songName);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the first song in the ordered set where songName = &#63;.
	 *
	 * @param songName the song name
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongName_First(String songName,
		OrderByComparator orderByComparator) throws SystemException {
		List<Song> list = findBySongName(songName, 0, 1, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last song in the ordered set where songName = &#63;.
	 *
	 * @param songName the song name
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongName_Last(String songName,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongName_Last(songName, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songName=");
		msg.append(songName);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the last song in the ordered set where songName = &#63;.
	 *
	 * @param songName the song name
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongName_Last(String songName,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countBySongName(songName);

		List<Song> list = findBySongName(songName, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the songs before and after the current song in the ordered set where songName = &#63;.
	 *
	 * @param songId the primary key of the current song
	 * @param songName the song name
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song[] findBySongName_PrevAndNext(long songId, String songName,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = findByPrimaryKey(songId);

		Session session = null;

		try {
			session = openSession();

			Song[] array = new SongImpl[3];

			array[0] = getBySongName_PrevAndNext(session, song, songName,
					orderByComparator, true);

			array[1] = song;

			array[2] = getBySongName_PrevAndNext(session, song, songName,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Song getBySongName_PrevAndNext(Session session, Song song,
		String songName, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_SONG_WHERE);

		if (songName == null) {
			query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_1);
		}
		else {
			if (songName.equals(StringPool.BLANK)) {
				query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_3);
			}
			else {
				query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_2);
			}
		}

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		if (songName != null) {
			qPos.add(songName);
		}

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(song);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Song> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the songs where songAuthor = &#63;.
	 *
	 * @param songAuthor the song author
	 * @return the matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongAuthor(String songAuthor)
		throws SystemException {
		return findBySongAuthor(songAuthor, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the songs where songAuthor = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songAuthor the song author
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @return the range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongAuthor(String songAuthor, int start, int end)
		throws SystemException {
		return findBySongAuthor(songAuthor, start, end, null);
	}

	/**
	 * Returns an ordered range of all the songs where songAuthor = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songAuthor the song author
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongAuthor(String songAuthor, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGAUTHOR;
			finderArgs = new Object[] { songAuthor };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGAUTHOR;
			finderArgs = new Object[] { songAuthor, start, end, orderByComparator };
		}

		List<Song> list = (List<Song>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Song song : list) {
				if (!Validator.equals(songAuthor, song.getSongAuthor())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_SONG_WHERE);

			if (songAuthor == null) {
				query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_1);
			}
			else {
				if (songAuthor.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_3);
				}
				else {
					query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_2);
				}
			}

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (songAuthor != null) {
					qPos.add(songAuthor);
				}

				list = (List<Song>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first song in the ordered set where songAuthor = &#63;.
	 *
	 * @param songAuthor the song author
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongAuthor_First(String songAuthor,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongAuthor_First(songAuthor, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songAuthor=");
		msg.append(songAuthor);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the first song in the ordered set where songAuthor = &#63;.
	 *
	 * @param songAuthor the song author
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongAuthor_First(String songAuthor,
		OrderByComparator orderByComparator) throws SystemException {
		List<Song> list = findBySongAuthor(songAuthor, 0, 1, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last song in the ordered set where songAuthor = &#63;.
	 *
	 * @param songAuthor the song author
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongAuthor_Last(String songAuthor,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongAuthor_Last(songAuthor, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songAuthor=");
		msg.append(songAuthor);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the last song in the ordered set where songAuthor = &#63;.
	 *
	 * @param songAuthor the song author
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongAuthor_Last(String songAuthor,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countBySongAuthor(songAuthor);

		List<Song> list = findBySongAuthor(songAuthor, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the songs before and after the current song in the ordered set where songAuthor = &#63;.
	 *
	 * @param songId the primary key of the current song
	 * @param songAuthor the song author
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song[] findBySongAuthor_PrevAndNext(long songId, String songAuthor,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = findByPrimaryKey(songId);

		Session session = null;

		try {
			session = openSession();

			Song[] array = new SongImpl[3];

			array[0] = getBySongAuthor_PrevAndNext(session, song, songAuthor,
					orderByComparator, true);

			array[1] = song;

			array[2] = getBySongAuthor_PrevAndNext(session, song, songAuthor,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Song getBySongAuthor_PrevAndNext(Session session, Song song,
		String songAuthor, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_SONG_WHERE);

		if (songAuthor == null) {
			query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_1);
		}
		else {
			if (songAuthor.equals(StringPool.BLANK)) {
				query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_3);
			}
			else {
				query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_2);
			}
		}

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		if (songAuthor != null) {
			qPos.add(songAuthor);
		}

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(song);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Song> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the songs where songCategory = &#63;.
	 *
	 * @param songCategory the song category
	 * @return the matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongCategory(int songCategory)
		throws SystemException {
		return findBySongCategory(songCategory, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the songs where songCategory = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songCategory the song category
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @return the range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongCategory(int songCategory, int start, int end)
		throws SystemException {
		return findBySongCategory(songCategory, start, end, null);
	}

	/**
	 * Returns an ordered range of all the songs where songCategory = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songCategory the song category
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongCategory(int songCategory, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGCATEGORY;
			finderArgs = new Object[] { songCategory };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGCATEGORY;
			finderArgs = new Object[] {
					songCategory,
					
					start, end, orderByComparator
				};
		}

		List<Song> list = (List<Song>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Song song : list) {
				if ((songCategory != song.getSongCategory())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_SONG_WHERE);

			query.append(_FINDER_COLUMN_SONGCATEGORY_SONGCATEGORY_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(songCategory);

				list = (List<Song>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first song in the ordered set where songCategory = &#63;.
	 *
	 * @param songCategory the song category
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongCategory_First(int songCategory,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongCategory_First(songCategory, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songCategory=");
		msg.append(songCategory);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the first song in the ordered set where songCategory = &#63;.
	 *
	 * @param songCategory the song category
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongCategory_First(int songCategory,
		OrderByComparator orderByComparator) throws SystemException {
		List<Song> list = findBySongCategory(songCategory, 0, 1,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last song in the ordered set where songCategory = &#63;.
	 *
	 * @param songCategory the song category
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongCategory_Last(int songCategory,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongCategory_Last(songCategory, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songCategory=");
		msg.append(songCategory);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the last song in the ordered set where songCategory = &#63;.
	 *
	 * @param songCategory the song category
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongCategory_Last(int songCategory,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countBySongCategory(songCategory);

		List<Song> list = findBySongCategory(songCategory, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the songs before and after the current song in the ordered set where songCategory = &#63;.
	 *
	 * @param songId the primary key of the current song
	 * @param songCategory the song category
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song[] findBySongCategory_PrevAndNext(long songId, int songCategory,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = findByPrimaryKey(songId);

		Session session = null;

		try {
			session = openSession();

			Song[] array = new SongImpl[3];

			array[0] = getBySongCategory_PrevAndNext(session, song,
					songCategory, orderByComparator, true);

			array[1] = song;

			array[2] = getBySongCategory_PrevAndNext(session, song,
					songCategory, orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Song getBySongCategory_PrevAndNext(Session session, Song song,
		int songCategory, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_SONG_WHERE);

		query.append(_FINDER_COLUMN_SONGCATEGORY_SONGCATEGORY_2);

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(songCategory);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(song);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Song> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the songs where songSinger = &#63;.
	 *
	 * @param songSinger the song singer
	 * @return the matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongSinger(String songSinger)
		throws SystemException {
		return findBySongSinger(songSinger, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the songs where songSinger = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songSinger the song singer
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @return the range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongSinger(String songSinger, int start, int end)
		throws SystemException {
		return findBySongSinger(songSinger, start, end, null);
	}

	/**
	 * Returns an ordered range of all the songs where songSinger = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param songSinger the song singer
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findBySongSinger(String songSinger, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SONGSINGER;
			finderArgs = new Object[] { songSinger };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SONGSINGER;
			finderArgs = new Object[] { songSinger, start, end, orderByComparator };
		}

		List<Song> list = (List<Song>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Song song : list) {
				if (!Validator.equals(songSinger, song.getSongSinger())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_SONG_WHERE);

			if (songSinger == null) {
				query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_1);
			}
			else {
				if (songSinger.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_3);
				}
				else {
					query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_2);
				}
			}

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (songSinger != null) {
					qPos.add(songSinger);
				}

				list = (List<Song>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first song in the ordered set where songSinger = &#63;.
	 *
	 * @param songSinger the song singer
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongSinger_First(String songSinger,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongSinger_First(songSinger, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songSinger=");
		msg.append(songSinger);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the first song in the ordered set where songSinger = &#63;.
	 *
	 * @param songSinger the song singer
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongSinger_First(String songSinger,
		OrderByComparator orderByComparator) throws SystemException {
		List<Song> list = findBySongSinger(songSinger, 0, 1, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last song in the ordered set where songSinger = &#63;.
	 *
	 * @param songSinger the song singer
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findBySongSinger_Last(String songSinger,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchBySongSinger_Last(songSinger, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("songSinger=");
		msg.append(songSinger);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the last song in the ordered set where songSinger = &#63;.
	 *
	 * @param songSinger the song singer
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchBySongSinger_Last(String songSinger,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countBySongSinger(songSinger);

		List<Song> list = findBySongSinger(songSinger, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the songs before and after the current song in the ordered set where songSinger = &#63;.
	 *
	 * @param songId the primary key of the current song
	 * @param songSinger the song singer
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song[] findBySongSinger_PrevAndNext(long songId, String songSinger,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = findByPrimaryKey(songId);

		Session session = null;

		try {
			session = openSession();

			Song[] array = new SongImpl[3];

			array[0] = getBySongSinger_PrevAndNext(session, song, songSinger,
					orderByComparator, true);

			array[1] = song;

			array[2] = getBySongSinger_PrevAndNext(session, song, songSinger,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Song getBySongSinger_PrevAndNext(Session session, Song song,
		String songSinger, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_SONG_WHERE);

		if (songSinger == null) {
			query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_1);
		}
		else {
			if (songSinger.equals(StringPool.BLANK)) {
				query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_3);
			}
			else {
				query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_2);
			}
		}

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		if (songSinger != null) {
			qPos.add(songSinger);
		}

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(song);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Song> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the songs where recordNumber = &#63;.
	 *
	 * @param recordNumber the record number
	 * @return the matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findByRecordNumber(long recordNumber)
		throws SystemException {
		return findByRecordNumber(recordNumber, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the songs where recordNumber = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param recordNumber the record number
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @return the range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findByRecordNumber(long recordNumber, int start, int end)
		throws SystemException {
		return findByRecordNumber(recordNumber, start, end, null);
	}

	/**
	 * Returns an ordered range of all the songs where recordNumber = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param recordNumber the record number
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findByRecordNumber(long recordNumber, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RECORDNUMBER;
			finderArgs = new Object[] { recordNumber };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_RECORDNUMBER;
			finderArgs = new Object[] {
					recordNumber,
					
					start, end, orderByComparator
				};
		}

		List<Song> list = (List<Song>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Song song : list) {
				if ((recordNumber != song.getRecordNumber())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_SONG_WHERE);

			query.append(_FINDER_COLUMN_RECORDNUMBER_RECORDNUMBER_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(recordNumber);

				list = (List<Song>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first song in the ordered set where recordNumber = &#63;.
	 *
	 * @param recordNumber the record number
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findByRecordNumber_First(long recordNumber,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchByRecordNumber_First(recordNumber, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("recordNumber=");
		msg.append(recordNumber);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the first song in the ordered set where recordNumber = &#63;.
	 *
	 * @param recordNumber the record number
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchByRecordNumber_First(long recordNumber,
		OrderByComparator orderByComparator) throws SystemException {
		List<Song> list = findByRecordNumber(recordNumber, 0, 1,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last song in the ordered set where recordNumber = &#63;.
	 *
	 * @param recordNumber the record number
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song findByRecordNumber_Last(long recordNumber,
		OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = fetchByRecordNumber_Last(recordNumber, orderByComparator);

		if (song != null) {
			return song;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("recordNumber=");
		msg.append(recordNumber);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSongException(msg.toString());
	}

	/**
	 * Returns the last song in the ordered set where recordNumber = &#63;.
	 *
	 * @param recordNumber the record number
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching song, or <code>null</code> if a matching song could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song fetchByRecordNumber_Last(long recordNumber,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countByRecordNumber(recordNumber);

		List<Song> list = findByRecordNumber(recordNumber, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the songs before and after the current song in the ordered set where recordNumber = &#63;.
	 *
	 * @param songId the primary key of the current song
	 * @param recordNumber the record number
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next song
	 * @throws com.mto.module.karaoke.NoSuchSongException if a song with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Song[] findByRecordNumber_PrevAndNext(long songId,
		long recordNumber, OrderByComparator orderByComparator)
		throws NoSuchSongException, SystemException {
		Song song = findByPrimaryKey(songId);

		Session session = null;

		try {
			session = openSession();

			Song[] array = new SongImpl[3];

			array[0] = getByRecordNumber_PrevAndNext(session, song,
					recordNumber, orderByComparator, true);

			array[1] = song;

			array[2] = getByRecordNumber_PrevAndNext(session, song,
					recordNumber, orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Song getByRecordNumber_PrevAndNext(Session session, Song song,
		long recordNumber, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_SONG_WHERE);

		query.append(_FINDER_COLUMN_RECORDNUMBER_RECORDNUMBER_2);

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(recordNumber);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(song);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Song> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the songs.
	 *
	 * @return the songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findAll() throws SystemException {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the songs.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @return the range of songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findAll(int start, int end) throws SystemException {
		return findAll(start, end, null);
	}

	/**
	 * Returns an ordered range of all the songs.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of songs
	 * @param end the upper bound of the range of songs (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of songs
	 * @throws SystemException if a system exception occurred
	 */
	public List<Song> findAll(int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = new Object[] { start, end, orderByComparator };

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
			finderArgs = FINDER_ARGS_EMPTY;
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
			finderArgs = new Object[] { start, end, orderByComparator };
		}

		List<Song> list = (List<Song>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;
			String sql = null;

			if (orderByComparator != null) {
				query = new StringBundler(2 +
						(orderByComparator.getOrderByFields().length * 3));

				query.append(_SQL_SELECT_SONG);

				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);

				sql = query.toString();
			}
			else {
				sql = _SQL_SELECT_SONG;
			}

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				if (orderByComparator == null) {
					list = (List<Song>)QueryUtil.list(q, getDialect(), start,
							end, false);

					Collections.sort(list);
				}
				else {
					list = (List<Song>)QueryUtil.list(q, getDialect(), start,
							end);
				}
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Removes all the songs where songName = &#63; from the database.
	 *
	 * @param songName the song name
	 * @throws SystemException if a system exception occurred
	 */
	public void removeBySongName(String songName) throws SystemException {
		for (Song song : findBySongName(songName)) {
			remove(song);
		}
	}

	/**
	 * Removes all the songs where songAuthor = &#63; from the database.
	 *
	 * @param songAuthor the song author
	 * @throws SystemException if a system exception occurred
	 */
	public void removeBySongAuthor(String songAuthor) throws SystemException {
		for (Song song : findBySongAuthor(songAuthor)) {
			remove(song);
		}
	}

	/**
	 * Removes all the songs where songCategory = &#63; from the database.
	 *
	 * @param songCategory the song category
	 * @throws SystemException if a system exception occurred
	 */
	public void removeBySongCategory(int songCategory)
		throws SystemException {
		for (Song song : findBySongCategory(songCategory)) {
			remove(song);
		}
	}

	/**
	 * Removes all the songs where songSinger = &#63; from the database.
	 *
	 * @param songSinger the song singer
	 * @throws SystemException if a system exception occurred
	 */
	public void removeBySongSinger(String songSinger) throws SystemException {
		for (Song song : findBySongSinger(songSinger)) {
			remove(song);
		}
	}

	/**
	 * Removes all the songs where recordNumber = &#63; from the database.
	 *
	 * @param recordNumber the record number
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByRecordNumber(long recordNumber)
		throws SystemException {
		for (Song song : findByRecordNumber(recordNumber)) {
			remove(song);
		}
	}

	/**
	 * Removes all the songs from the database.
	 *
	 * @throws SystemException if a system exception occurred
	 */
	public void removeAll() throws SystemException {
		for (Song song : findAll()) {
			remove(song);
		}
	}

	/**
	 * Returns the number of songs where songName = &#63;.
	 *
	 * @param songName the song name
	 * @return the number of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public int countBySongName(String songName) throws SystemException {
		Object[] finderArgs = new Object[] { songName };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SONGNAME,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SONG_WHERE);

			if (songName == null) {
				query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_1);
			}
			else {
				if (songName.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_3);
				}
				else {
					query.append(_FINDER_COLUMN_SONGNAME_SONGNAME_2);
				}
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (songName != null) {
					qPos.add(songName);
				}

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SONGNAME,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of songs where songAuthor = &#63;.
	 *
	 * @param songAuthor the song author
	 * @return the number of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public int countBySongAuthor(String songAuthor) throws SystemException {
		Object[] finderArgs = new Object[] { songAuthor };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SONGAUTHOR,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SONG_WHERE);

			if (songAuthor == null) {
				query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_1);
			}
			else {
				if (songAuthor.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_3);
				}
				else {
					query.append(_FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_2);
				}
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (songAuthor != null) {
					qPos.add(songAuthor);
				}

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SONGAUTHOR,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of songs where songCategory = &#63;.
	 *
	 * @param songCategory the song category
	 * @return the number of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public int countBySongCategory(int songCategory) throws SystemException {
		Object[] finderArgs = new Object[] { songCategory };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SONGCATEGORY,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SONG_WHERE);

			query.append(_FINDER_COLUMN_SONGCATEGORY_SONGCATEGORY_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(songCategory);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SONGCATEGORY,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of songs where songSinger = &#63;.
	 *
	 * @param songSinger the song singer
	 * @return the number of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public int countBySongSinger(String songSinger) throws SystemException {
		Object[] finderArgs = new Object[] { songSinger };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SONGSINGER,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SONG_WHERE);

			if (songSinger == null) {
				query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_1);
			}
			else {
				if (songSinger.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_3);
				}
				else {
					query.append(_FINDER_COLUMN_SONGSINGER_SONGSINGER_2);
				}
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (songSinger != null) {
					qPos.add(songSinger);
				}

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SONGSINGER,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of songs where recordNumber = &#63;.
	 *
	 * @param recordNumber the record number
	 * @return the number of matching songs
	 * @throws SystemException if a system exception occurred
	 */
	public int countByRecordNumber(long recordNumber) throws SystemException {
		Object[] finderArgs = new Object[] { recordNumber };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RECORDNUMBER,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SONG_WHERE);

			query.append(_FINDER_COLUMN_RECORDNUMBER_RECORDNUMBER_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(recordNumber);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RECORDNUMBER,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of songs.
	 *
	 * @return the number of songs
	 * @throws SystemException if a system exception occurred
	 */
	public int countAll() throws SystemException {
		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
				FINDER_ARGS_EMPTY, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(_SQL_COUNT_SONG);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
					FINDER_ARGS_EMPTY, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Initializes the song persistence.
	 */
	public void afterPropertiesSet() {
		String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
					com.liferay.util.service.ServiceProps.get(
						"value.object.listener.com.mto.module.karaoke.model.Song")));

		if (listenerClassNames.length > 0) {
			try {
				List<ModelListener<Song>> listenersList = new ArrayList<ModelListener<Song>>();

				for (String listenerClassName : listenerClassNames) {
					listenersList.add((ModelListener<Song>)InstanceFactory.newInstance(
							listenerClassName));
				}

				listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
			}
			catch (Exception e) {
				_log.error(e);
			}
		}
	}

	public void destroy() {
		EntityCacheUtil.removeCache(SongImpl.class.getName());
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	@BeanReference(type = CategoryPersistence.class)
	protected CategoryPersistence categoryPersistence;
	@BeanReference(type = SongPersistence.class)
	protected SongPersistence songPersistence;
	@BeanReference(type = UserSongsPersistence.class)
	protected UserSongsPersistence userSongsPersistence;
	@BeanReference(type = ResourcePersistence.class)
	protected ResourcePersistence resourcePersistence;
	@BeanReference(type = UserPersistence.class)
	protected UserPersistence userPersistence;
	private static final String _SQL_SELECT_SONG = "SELECT song FROM Song song";
	private static final String _SQL_SELECT_SONG_WHERE = "SELECT song FROM Song song WHERE ";
	private static final String _SQL_COUNT_SONG = "SELECT COUNT(song) FROM Song song";
	private static final String _SQL_COUNT_SONG_WHERE = "SELECT COUNT(song) FROM Song song WHERE ";
	private static final String _FINDER_COLUMN_SONGNAME_SONGNAME_1 = "song.songName IS NULL";
	private static final String _FINDER_COLUMN_SONGNAME_SONGNAME_2 = "song.songName = ?";
	private static final String _FINDER_COLUMN_SONGNAME_SONGNAME_3 = "(song.songName IS NULL OR song.songName = ?)";
	private static final String _FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_1 = "song.songAuthor IS NULL";
	private static final String _FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_2 = "song.songAuthor = ?";
	private static final String _FINDER_COLUMN_SONGAUTHOR_SONGAUTHOR_3 = "(song.songAuthor IS NULL OR song.songAuthor = ?)";
	private static final String _FINDER_COLUMN_SONGCATEGORY_SONGCATEGORY_2 = "song.songCategory = ?";
	private static final String _FINDER_COLUMN_SONGSINGER_SONGSINGER_1 = "song.songSinger IS NULL";
	private static final String _FINDER_COLUMN_SONGSINGER_SONGSINGER_2 = "song.songSinger = ?";
	private static final String _FINDER_COLUMN_SONGSINGER_SONGSINGER_3 = "(song.songSinger IS NULL OR song.songSinger = ?)";
	private static final String _FINDER_COLUMN_RECORDNUMBER_RECORDNUMBER_2 = "song.recordNumber = ?";
	private static final String _ORDER_BY_ENTITY_ALIAS = "song.";
	private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Song exists with the primary key ";
	private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Song exists with the key {";
	private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get(
				PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE));
	private static Log _log = LogFactoryUtil.getLog(SongPersistenceImpl.class);
	private static Song _nullSong = new SongImpl() {
			@Override
			public Object clone() {
				return this;
			}

			@Override
			public CacheModel<Song> toCacheModel() {
				return _nullSongCacheModel;
			}
		};

	private static CacheModel<Song> _nullSongCacheModel = new CacheModel<Song>() {
			public Song toEntityModel() {
				return _nullSong;
			}
		};
}